import numpy as np
from  multiprocessing import Process , Pipe
import cv2,Queue


lower_blue = np.array([0,0,0])
upper_blue = np.array([170,255,46])
cap = cv2.VideoCapture(0)

def Frame_HSV(e1 , frame , conn):
	hsv = cv2.cvtColor(frame,cv2.COLOR_BGR2HSV)
	mask = cv2.inRange(hsv,lower_blue,upper_blue)
	conn.send(mask)
	conn.close()
	
while(True):
	parent_conn, child_conn = Pipe()
	ret, frame = cap.read()
	
	e1 = cv2.getTickCount()
	p = Process(target = Frame_HSV ,args = (e1 ,frame ,child_conn))
	p.start()
	p.join()
	
	print parent_conn.recv() 
	if cv2.waitKey(1) & 0xFF == ord('q'):
		break
cap.release()
cv2.destroyAllWindows()






